package com.ropeok.controller;

import com.ropeok.domain.ResponseResult;
import com.ropeok.domain.User;
import com.ropeok.domain.UserRole;
import com.ropeok.service.UserRoleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

/**
 * @BelongsProject: training-mission
 * @BelongsPackage: com.ropeok.controller
 * @Author: zhofeifan
 * @CreateTime: 2022-09-26  14:26
 * @Description: 分配权限
 * @Version: 1.0
 */
@RestController
public class UserRoleController {
    @Autowired
    private UserRoleService userRoleService;
    @PutMapping("/userRole")
    @PreAuthorize("hasAuthority('system:dept:list')")
    public ResponseResult updateUser(@RequestBody UserRole userRole){
        userRoleService.updateUser(userRole);
        return new ResponseResult(200,"更新成功");
    }
}
